<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'reviewcustom.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	<script>
			function reviewcustom(){
				var str="";
				var ch=document.getElementsByName("check");
				for(var i=0;i<ch.length;i++){
					  if (ch[i].checked)
             		  {
             		  	str=str+ch[i].value+",";
              		  }	
				}
				if(str==""){
					alert("没有选中审核项");
				}else{
					$.post("ReviewCustomAction",{"Array":str},function(data){
						if(data=="success"){
							alert("审核完成");
							for(var i=0;i<ch.length;i++){
								  if (ch[i].checked)
			             		  {
			             		  	ch[i].checked=false;
			                      	$("#"+ch[i].value).hide(); 
			              		  }	
							}
						}	
				});
				}
			}
	</script>
  </head>
  
  <body>
   				<div id="showcustom_all">
	   					<c:if test="${fn:length(custom)<=0}">
	      					没有任何需要审核的定制
	      				</c:if>
	      				<c:if test="${fn:length(custom)>0}">
	      					<c:forEach items="${custom}" var="cus">
   								<span id="${cus.customId}" style="height: 100px;width: 100px;">
   										<img src="${cus.customPic}" width="200px" height="200px;">
   										<input name="check" type="checkbox" value="${cus.customId}" checked="checked">					
   								</span>
   							</c:forEach><br/>
   							<input type="button" value="审核订单" onclick="reviewcustom()">
	      				</c:if>
   				</div>
  </body>
</html>
